rubyterm 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dad934f37ee68f63661c2d7bbd2e8c7af64a8811fb8fd27b9d5bd63787a8f021
4
- data.tar.gz: 124c7b36ea94bef960b7bbc78f9143149cce43cf443b4e7d9ed99207e40d1f01
3
+ metadata.gz: a3ad358ca60e1bd23c01f81186b75826f64f1ba9cb519a149a33d56106561062
4
+ data.tar.gz: e367c640889e4724e4266410735df54fbd89a56536d48e4c94b72c8343bd3ac2
5
5
  SHA512:
6
- metadata.gz: ea7bf3f07aa5088ca07bc79058aa836d20af2c95d5d6887d7fe5e7fd8f44283170c4fa2df7078d5f10a271582b5d339143473e8fc3d1af51d74c42f562e3e0a5
7
- data.tar.gz: 491468d6aab9c96754001425718102aaa1c677c994ca1f82c47a3fa07196327bb3ed132ef72c547d77904216f6ed9f700373fdd3c6b08cae3769904f36f562a9
6
+ metadata.gz: b70f474074dfbcbc6eac034340155de305f4ea8fb8daf43a89c82d88c2e5d18ebcedfb81567d230b62e57c63c82e8226533ecc4d20e994058772224149544678
7
+ data.tar.gz: a98d2d55fda7b4954612b82064dde3b95b58884a2e9ade88c65d75e1475c36982db442795a6e8d5514b61ed7b78e4f701235e9cc995442141ea3364cda14369a
data/lib/rubyterm/app.rb CHANGED
@@ -420,6 +420,25 @@ class RubyTerm
420
420
  @buffer.draw_flush
421
421
  end
422
422
 
423
+ # A line of the scroll region [start..bottom] has scrolled up into
424
+ # history. The selection is stored in *buffer* coordinates (negative rows
425
+ # = scrollback), so the content the user selected now sits one row higher:
426
+ # cells inside the scrolled region - and anything already in scrollback,
427
+ # whose negative index shifts as the history grows - move up by one, while
428
+ # content below the region stays put. Shift the stored selection to match
429
+ # so reapply_selection keeps the highlight pinned to the same text as it
430
+ # scrolls (into scrollback and back), instead of leaving it on whatever
431
+ # rolls into the old screen rows. Called from TrackChanges#scroll_up via
432
+ # the adapter for every line moved into history.
433
+ def shift_selection_for_scroll(start, bottom)
434
+ return unless @select_startpos
435
+ [@select_startpos, @select_endpos].each do |pos|
436
+ next unless pos
437
+ y = pos[1]
438
+ pos[1] -= 1 if y < 0 || (y >= start && y <= bottom)
439
+ end
440
+ end
441
+
423
442
  # FIXME: Cursor, selection etc. are "special" overlays on top of attributes.
424
443
  # Allow the terminal to set a set of positions + fg/bg, and a set of ranges.
425
444
  def render_selection
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class RubyTerm
4
- VERSION = "0.2.5"
4
+ VERSION = "0.2.6"
5
5
  end
data/lib/trackchanges.rb CHANGED
@@ -69,6 +69,10 @@ class TrackChanges
69
69
  start = @buffer.scroll_start.to_i
70
70
  bottom = @buffer.scroll_end || (@rows - 1)
71
71
  @buffer.scroll_up
72
+ # The content moved up in the buffer; keep any active text selection
73
+ # pinned to it. Done before the @suspend bail-out so the selection stays
74
+ # aligned even through jump-scrolled (unrendered) frames.
75
+ @adapter.scroll_selection(start, bottom)
72
76
  return if @suspend
73
77
  if @adapter.scrollback_mode
74
78
  @adapter.scrollback_anchor
data/lib/windowadapter.rb CHANGED
@@ -30,6 +30,14 @@ class WindowAdapter
30
30
  # offset instead of letting the viewport drift.
31
31
  def scrollback_anchor = @window.scrollback_anchor
32
32
 
33
+ # A line of the scroll region [start..bottom] has moved into history.
34
+ # Forward to the orchestrator so it can keep a live text selection pinned
35
+ # to the content it covers. The headless harness/bench hosts have no
36
+ # selection state and do not implement this, so it no-ops there.
37
+ def scroll_selection(start, bottom)
38
+ @term.shift_selection_for_scroll(start, bottom) if @term.respond_to?(:shift_selection_for_scroll)
39
+ end
40
+
33
41
  # DECCOLM: the terminal asked to switch to +cols+ columns (80/132). The
34
42
  # orchestrator (RubyTerm) owns the window pixels, font scale, config and
35
43
  # the pty size report, so delegate to it. The headless harness "term"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyterm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vidar Hokstad
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-27 00:00:00.000000000 Z
11
+ date: 2026-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pure-x11