Skip to content

fix: batch clipboard paste signals - #212

Merged
Dream-Master merged 1 commit into
GTNewHorizons:masterfrom
shironakoushi:master
Jul 26, 2026
Merged

fix: batch clipboard paste signals#212
Dream-Master merged 1 commit into
GTNewHorizons:masterfrom
shironakoushi:master

Conversation

@shironakoushi

Copy link
Copy Markdown

Motivation

Clipboard input was previously converted into one signal per line using linesWithSeparators.

Because machine signal queues are limited, files containing many short lines could be truncated even when their total size was relatively small. The misc.maxClipboard configuration value existed, but was NOT used by this signal path. Many players even attempted to condense their scripts into a single line. It's painful.

Large pastes into the OpenOS editor also trigger many GPU redraw operations, which could exhaust the computer's energy before all clipboard signals were processed. Energy usage is not necessary.

Summary

  • Wire misc.maxClipboard into runtime settings.
  • Pack clipboard text into maximum-sized signal chunks across line boundaries while preserving line separators.
  • Derive the client-side paste limit from the clipboard chunk size and machine signal queue capacity.
  • Avoid charging normal computer and GPU operation energy while processing clipboard input.

Checklist

  • I have tested this PR in DevEnv
  • I have tested this PR in Fullpack
  • This PR is in compliance with the GTNH AI Policy
  • This PR requires another PR in order to merge

Comment thread src/main/resources/application.conf Outdated
Comment thread src/main/scala/li/cil/oc/server/component/GraphicsCard.scala Outdated

@Azusfin Azusfin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good job!

@Dream-Master
Dream-Master merged commit 534a77a into GTNewHorizons:master Jul 26, 2026
1 check passed
@hinyb

hinyb commented Jul 27, 2026

Copy link
Copy Markdown

Hi @shironakoushi , thanks for your work on this!
However, I'm a bit concerned about this PR, because it introduces a breaking change to how clipboard pasting signals work.
Switching from per-line signals to 256-character batches will break existing scripts that expect the old behavior.
Additionally, the issue this PR tries to solve (the 256 signal queue limit) is already configurable in the OC settings.
And the original dev actually looked into multi-line pasting before, but decided against it just to avoid this exact issue (see MightyPirates#3084 (comment)).
For these reasons, I believe this new behavior at least needs a config to toggle it, so we don't break backward compatibility. Would you be open to making a follow-up PR to add a toggle for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants