echoes 0.4.0 → 0.5.0

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: 988274d532cf54ecb84bae874115f635b993e6817c259c41811b33265c55d725
4
- data.tar.gz: 73f6868b563a851c1d171908f92ad7cf6ad8dd046f101c178f826a18790f8d0f
3
+ metadata.gz: d12ae8bf0fab5f169c0d380125005490662167338fb529d6c0a1c3daf725a415
4
+ data.tar.gz: dabea435d3121c0411048313744738e62f759de537f4afd4e4d28dc378188cea
5
5
  SHA512:
6
- metadata.gz: 5120ced363551ab708776569564b96754c70d7dfe06056b3c97e0b3749e24b4fd87e060f126cacea6de655fb9b78dd1910a22eb49988b772aace46b6e0a5d99f
7
- data.tar.gz: 7131de98f47c8a16d7ae6aeaef86a74af5d58412fa9c2d2b4948ee03734c97ed63d4329e186dbf83c1d4765ae148141119a20a55e4b1facfc26a7db181346dd7
6
+ metadata.gz: c6306b65e5234b7e35cdb5624ae04b6a0585c5a418bbab22ca8d517a9c8aa928c5e6fdcf0b826d333fa73870275046efd16c4519bccf8d35de7959fba8958d08
7
+ data.tar.gz: 8481081986ffd00775f18a9fd6a5b8a0f3691e0f030c9f6f601b898f1ffc875d8c266b191ca0489e85e39cf6d7117c19843c68dbf9f2a091ec5fa757addcb5f6
data/lib/echoes/screen.rb CHANGED
@@ -243,20 +243,20 @@ module Echoes
243
243
  mc_rows = cells_h && cells_h > 0 ? cells_h : (height / @cell_pixel_height).ceil
244
244
  mc_cols = [mc_cols, 1].max
245
245
  mc_rows = [mc_rows, 1].max
246
- return if mc_cols > @cols || mc_rows > @rows
247
-
248
246
  if suppress_cursor
249
247
  # C=1 (slide-presentation mode): anchor at the current
250
248
  # cursor without wrapping or scrolling. A multi-image
251
249
  # slideshow would otherwise accumulate a cumulative
252
250
  # scroll offset every time an image landed near the
253
- # bottom, dragging earlier rows off-screen. If the image
254
- # doesn't fit at the current position, bail the client
255
- # positions the cursor deliberately and would rather see
256
- # nothing than have the layout shift out from under it.
257
- return if @cursor.col + mc_cols > @cols
258
- return if @cursor.row + mc_rows > @rows
251
+ # bottom, dragging earlier rows off-screen. Oversize
252
+ # placements are registered at the cursor anywayonly
253
+ # the cells inside the grid get reserved as multicell
254
+ # anchors / continuations; the rest of the image draws
255
+ # via the GUI's blit pass and clips at the pane rect.
256
+ # (Used to bail out entirely on oversize; presentation
257
+ # clients prefer "show what fits" to "show nothing.")
259
258
  else
259
+ return if mc_cols > @cols || mc_rows > @rows
260
260
  if @cursor.col + mc_cols > @cols
261
261
  @cursor.col = 0
262
262
  line_feed
@@ -270,8 +270,19 @@ module Echoes
270
270
  anchor_row = @cursor.row
271
271
  anchor_col = @cursor.col
272
272
 
273
- mc_rows.times do |dr|
274
- mc_cols.times do |dc|
273
+ # How many cells of the multicell footprint actually land
274
+ # inside the grid. For images that fit, this equals the full
275
+ # mc_cols / mc_rows; oversize C=1 placements get clamped so
276
+ # we never index past `@grid`. The placement entry below
277
+ # still records the full mc_cols × mc_rows so the GUI draws
278
+ # the unclipped image and the pane-rect clip handles the
279
+ # overflowing pixels.
280
+ reservable_cols = [mc_cols, @cols - anchor_col].min
281
+ reservable_rows = [mc_rows, @rows - anchor_row].min
282
+ return if reservable_cols < 1 || reservable_rows < 1
283
+
284
+ reservable_rows.times do |dr|
285
+ reservable_cols.times do |dc|
275
286
  erase_multicell_at(anchor_row + dr, anchor_col + dc)
276
287
  end
277
288
  end
@@ -286,14 +297,17 @@ module Echoes
286
297
  # pass off `screen.placements`, not via mc[:sixel]. Keeps
287
298
  # the kitty path independent of the cell loop so deletes,
288
299
  # scrolls, and font changes affect drawing through one
289
- # code path.
300
+ # code path. `cols` / `rows` carry the *full* image extent
301
+ # — the GUI uses those for the pixel draw rect — even when
302
+ # only `reservable_*` of those cells actually fit on the
303
+ # grid.
290
304
  anchor.multicell = {
291
305
  cols: mc_cols, rows: mc_rows, scale: 1,
292
306
  frac_n: 0, frac_d: 0, valign: 0, halign: 0,
293
307
  }
294
308
 
295
- mc_rows.times do |dr|
296
- mc_cols.times do |dc|
309
+ reservable_rows.times do |dr|
310
+ reservable_cols.times do |dc|
297
311
  next if dr == 0 && dc == 0
298
312
  cont = @grid[anchor_row + dr][anchor_col + dc]
299
313
  cont.reset!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Echoes
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: echoes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akira Matsuda