Skip to content

Commit

Permalink
Rename sublang to heredoc
Browse files Browse the repository at this point in the history
  • Loading branch information
focus-editor committed Mar 21, 2024
1 parent e930577 commit d5e27bd
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions FOCUS-CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ROUGH ROADMAP

- Workspace search improvements (the ability to filter additionally by filename)
- Workspace search improvements (the ability to filter additionally by filename, global replace etc)
- Settings per file type
- Add the ability to assign syntax to a buffer
- Basic language definition files for the highlighting of languages we don't yet support
Expand All @@ -26,7 +26,7 @@
+ C# highlighting: support nested string interpolation (thanks @audV)
+ New option: `show_selected_text_length`. Set to `true` to display the number of selected chars (and bytes) in the footer (thanks @CELLTH)
+ New command: `open_another_editor_instance`. Defaults to Ctrl-Shift-Alt-N. Opens a new editor instance as a subprocess. Thanks @LainLayer
+ In Jai, `#string` literals will now support highlighting text. E.g. `#string STR_PYTHON` will highlight the contents as python. The name needs to end with the desired language name. The string block can have a special background color (set as `region_sublang` in the config)
+ In Jai, `#string` literals will now support highlighting text. E.g. `#string STR_PYTHON` will highlight the contents as python. The name needs to end with the desired language name. The string block can have a special background color (called `region_heredoc` in the config)
+ Bug fixes:
+ Fixed a bug with cursor positioning when using the align_cursors action through the command dialog
+ Fixed a visual glitch when attempting to draw tabs as characters in a new buffer name
Expand Down
2 changes: 1 addition & 1 deletion config/default.focus-config
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ region_header: 1A5152FF
region_success: 226022FF
region_warning: 986032FF
region_error: 772222FF
region_sublang: 090e12FF
region_heredoc: 090e12FF

selection_active: 1C4449FF
selection_inactive: 1C44497F
Expand Down
2 changes: 1 addition & 1 deletion config/default_macos.focus-config
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ region_header: 1A5152FF
region_success: 226022FF
region_warning: 986032FF
region_error: 772222FF
region_sublang: 090e12FF
region_heredoc: 090e12FF

selection_active: 1C4449FF
selection_inactive: 1C44497F
Expand Down
6 changes: 3 additions & 3 deletions src/buffer.jai
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,8 @@ recalculate_colors :: (buffer: *Buffer) {
if region.note then region.note = copy_string(region.note);
array_add(*buffer.regions, region.*);

// Maybe tokenize sublangs
if region.kind == .sublang {
// Maybe tokenize heredocs
if region.kind == .heredoc {
tokenize := get_tokenize_function(region.lang);
if tokenize != null then tokenize(buffer, region.start, region.end - region.start); // ignore subregions here
}
Expand Down Expand Up @@ -1400,7 +1400,7 @@ Buffer_Region :: struct {
scope_file;
scope_module;

sublang;
heredoc;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/colors.jai
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Color :: enum u8 {
REGION_SUCCESS;
REGION_WARNING;
REGION_ERROR;
REGION_SUBLANG;
REGION_HEREDOC;

BUILD_PANEL_BACKGROUND;
BUILD_PANEL_SCROLLBAR;
Expand Down
2 changes: 1 addition & 1 deletion src/config_parser.jai
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ map_name_to_color :: (name: string) -> Color {
case "region_success"; return .REGION_SUCCESS;
case "region_warning"; return .REGION_WARNING;
case "region_error"; return .REGION_ERROR;
case "region_sublang"; return .REGION_SUBLANG;
case "region_heredoc"; return .REGION_HEREDOC;

case "build_panel_background"; return .BUILD_PANEL_BACKGROUND;
case "build_panel_scrollbar"; return .BUILD_PANEL_SCROLLBAR;
Expand Down
2 changes: 1 addition & 1 deletion src/draw.jai
Original file line number Diff line number Diff line change
Expand Up @@ -3303,7 +3303,7 @@ get_region_color :: (kind: Buffer_Region.Kind) -> Color {
color := Color.BACKGROUND_0;
if #complete kind == {
case .none; // nothing
case .sublang; color = Color.REGION_SUBLANG;
case .heredoc; color = Color.REGION_HEREDOC;
case .scope_export; color = Color.REGION_SCOPE_EXPORT;
case .scope_file; color = Color.REGION_SCOPE_FILE;
case .scope_module; color = Color.REGION_SCOPE_MODULE;
Expand Down
4 changes: 2 additions & 2 deletions src/langs/jai.jai
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ parse_identifier :: (using tokenizer: *Jai_Tokenizer, token: *Token) {
t = buf.data + end + identifier_str.count;
}

// Maybe add a sublang region for deferred highlighting
// Maybe add a heredoc region for deferred highlighting
lang := get_lang_from_name(identifier_str);
if lang != .Plain_Text {
array_add(*regions, Buffer_Region.{ start = start + 1, end = xx end, kind = .sublang, lang = lang }); // start + 1 to not include the newline
array_add(*regions, Buffer_Region.{ start = start + 1, end = xx end, kind = .heredoc, lang = lang }); // start + 1 to not include the newline
}

} else if prev.type == .punctuation && prev.punctuation == .comma {
Expand Down

0 comments on commit d5e27bd

Please sign in to comment.