@@ -445,6 +445,27 @@ Array nvim_buf_get_extmarks(Buffer buffer, Integer ns_id, Object start, Object e
445
445
/// - strict: boolean that indicates extmark should not be placed
446
446
/// if the line or column value is past the end of the
447
447
/// buffer or end of the line respectively. Defaults to true.
448
+
/// - sign_text: string of length 1-2 used to display in the
449
+
/// sign column.
450
+
/// Note: ranges are unsupported and decorations are only
451
+
/// applied to start_row
452
+
/// - sign_hl_group: name of the highlight group used to
453
+
/// highlight the sign column text.
454
+
/// Note: ranges are unsupported and decorations are only
455
+
/// applied to start_row
456
+
/// - number_hl_group: name of the highlight group used to
457
+
/// highlight the number column.
458
+
/// Note: ranges are unsupported and decorations are only
459
+
/// applied to start_row
460
+
/// - line_hl_group: name of the highlight group used to
461
+
/// highlight the whole line.
462
+
/// Note: ranges are unsupported and decorations are only
463
+
/// applied to start_row
464
+
/// - cursorline_hl_group: name of the highlight group used to
465
+
/// highlight the line when the cursor is on the same line
466
+
/// as the mark and 'cursorline' is enabled.
467
+
/// Note: ranges are unsupported and decorations are only
468
+
/// applied to start_row
448
469
///
449
470
/// @param[out] err Error details, if any
450
471
/// @return Id of the created/updated extmark
@@ -519,10 +540,25 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
519
540
goto error;
520
541
}
521
542
522
-
if (HAS_KEY(opts->hl_group)) {
523
-
decor.hl_id = object_to_hl_id(opts->hl_group, "hl_group", err);
524
-
if (ERROR_SET(err)) {
525
-
goto error;
543
+
struct {
544
+
const char *name;
545
+
Object *opt;
546
+
int *dest;
547
+
} hls[] = {
548
+
{ "hl_group" , &opts->hl_group , &decor.hl_id },
549
+
{ "sign_hl_group" , &opts->sign_hl_group , &decor.sign_hl_id },
550
+
{ "number_hl_group" , &opts->number_hl_group , &decor.number_hl_id },
551
+
{ "line_hl_group" , &opts->line_hl_group , &decor.line_hl_id },
552
+
{ "cursorline_hl_group", &opts->cursorline_hl_group, &decor.cursorline_hl_id },
553
+
{ NULL, NULL, NULL },
554
+
};
555
+
556
+
for (int j = 0; hls[j].name && hls[j].dest; j++) {
557
+
if (HAS_KEY(*hls[j].opt)) {
558
+
*hls[j].dest = object_to_hl_id(*hls[j].opt, hls[j].name, err);
559
+
if (ERROR_SET(err)) {
560
+
goto error;
561
+
}
526
562
}
527
563
}
528
564
@@ -622,6 +658,17 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
622
658
goto error;
623
659
}
624
660
661
+
if (opts->sign_text.type == kObjectTypeString) {
662
+
if (!init_sign_text(&decor.sign_text,
663
+
(char_u *)opts->sign_text.data.string.data)) {
664
+
api_set_error(err, kErrorTypeValidation, "sign_text is not a valid value");
665
+
goto error;
666
+
}
667
+
} else if (HAS_KEY(opts->sign_text)) {
668
+
api_set_error(err, kErrorTypeValidation, "sign_text is not a String");
669
+
goto error;
670
+
}
671
+
625
672
bool right_gravity = true;
626
673
OPTION_TO_BOOL(right_gravity, right_gravity, true);
627
674
@@ -709,6 +756,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
709
756
710
757
error:
711
758
clear_virttext(&decor.virt_text);
759
+
xfree(decor.sign_text);
712
760
return 0;
713
761
}
714
762
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4