antares 0.2.0 → 0.2.2

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: 0243ed5a88d91e34cf4654f9e3437d590e9079caea1976fde034213dbf28ab8c
4
- data.tar.gz: 77b2751092cc3f1fb5dd9aaf7dc0615c724512d958f1bfe7a198bc7cad70b463
3
+ metadata.gz: 1c2ea1e51f704d6c2181103ad704401abb9977724f6139c02df420bdb711f71d
4
+ data.tar.gz: fe214d18846dfa84a061ea93dc35415a92597f6b376469251333fb45b9a19b9e
5
5
  SHA512:
6
- metadata.gz: b24e5c58ad94c655378e327344a9404a73a5bf57185d44854f84ab831bd29857381c5117ee3de4ac00a5de044e2c23560c564cf0a16bd7aa62a369546dc805f1
7
- data.tar.gz: b988ef69cdf0395af22403e427677ebef54b1fe84cbbeae4b4a2127e0b4c78a243ce8fde131acf6cd0fc79aa3828c078b7dcb6057cb376bde3abcd1ee646c907
6
+ metadata.gz: 38f5e5db511a43618e51175b2440addf02ccd8c2cd5d3b5607b66520f391924d47979a2d565f0e4a2375a3d492ed79cb5e8c255c469a16e136d446f73fdcd32a
7
+ data.tar.gz: 7aae8c8a2e1e0159f15e0d794906cd6262b95b46f95a4b3437761ffb71ea9be935a42571c013142de99d9b440895db4ccbf9c35760f92ba427d4b0801440bc9c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.2 — 2026-09-21
4
+
5
+ - Add a deterministic syntax-highlighting demo image and regeneration task.
6
+
7
+ ## 0.2.1 — 2026-09-16
8
+
9
+ - Keep expanding-selection columns within CRLF line content.
10
+
3
11
  ## 0.2.0 — 2026-09-15
4
12
 
5
13
  - Add edit-aware bracket matching and depth information.
data/README.md CHANGED
@@ -24,6 +24,8 @@
24
24
 
25
25
  Antares adds edit-aware, line-oriented syntax highlighting to [Rouge](https://github.com/rouge-ruby/rouge). It reuses lexer state where compatibility tests show that incremental highlighting is safe, and falls back to bounded re-highlighting for other lexers. Document storage and colors remain with the caller.
26
26
 
27
+ ![Antares syntax highlighting](docs/media/screenshot.png)
28
+
27
29
  ## Features
28
30
 
29
31
  <a name="features"></a>
@@ -104,7 +104,7 @@ module Antares
104
104
  kind: :block, label: bracket.kind)
105
105
  end
106
106
  ranges << Region.new(start_line: line, end_line: line, start_column: 0,
107
- end_column: @line_data.fetch(line).text.delete_suffix("\n").length,
107
+ end_column: line_content(@line_data.fetch(line).text).length,
108
108
  kind: :line, label: @line_data.fetch(line).label)
109
109
  ranges.concat(context_at(line).reverse)
110
110
  ranges.uniq { |region| [region.start_line, region.start_column, region.end_line, region.end_column] }
@@ -356,8 +356,9 @@ module Antares
356
356
  unless value.strip.empty?
357
357
  token_kind = @token_kinds[type] ||= classify_token(type.qualname)
358
358
  kind = token_kind == :comment ? :comment : (token_kind == :string ? :string : :token)
359
- span_finish = value.end_with?("\n") ? finish - 1 : finish
360
- span = [column, span_finish, kind, value.delete_suffix("\n")] if span_finish > column
359
+ content = line_content(value)
360
+ span_finish = column + content.length
361
+ span = [column, span_finish, kind, content] if span_finish > column
361
362
  end
362
363
  column = finish
363
364
  span
@@ -389,10 +390,14 @@ module Antares
389
390
  raise ArgumentError, "column must be a nonnegative integer" unless column.is_a?(Integer) && column >= 0
390
391
  refresh(brackets: brackets, folds: folds)
391
392
  text = @line_data.fetch(line).text
392
- last = text.end_with?("\n") ? text.length - 1 : text.length
393
+ last = line_content(text).length
393
394
  raise RangeError, "column outside line" if column > last
394
395
  end
395
396
 
397
+ def line_content(text)
398
+ text.end_with?("\r\n") ? text.delete_suffix("\r\n") : text.delete_suffix("\n")
399
+ end
400
+
396
401
  def validate_line(line)
397
402
  raise RangeError, "line outside document" unless line.is_a?(Integer) && line >= 0 && line < line_count
398
403
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Antares
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: antares
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yudai Takada