+11
-3
lines changedFilter options
+11
-3
lines changed Original file line number Diff line number Diff line change
@@ -404,6 +404,10 @@ Array nvim_buf_get_extmarks(Buffer buffer, Integer ns_id, Object start, Object e
404
404
/// for left). Defaults to false.
405
405
/// - priority: a priority value for the highlight group. For
406
406
/// example treesitter highlighting uses a value of 100.
407
+
/// - strict: boolean that indicates extmark should be placed
408
+
/// even if the line or column value is past the end of the
409
+
/// buffer or end of the line respectively. Defaults to true.
410
+
///
407
411
/// @param[out] err Error details, if any
408
412
/// @return Id of the created/updated extmark
409
413
Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer col,
@@ -596,7 +600,10 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
596
600
bool ephemeral = false;
597
601
OPTION_TO_BOOL(ephemeral, ephemeral, false);
598
602
599
-
if (line < 0 || line > buf->b_ml.ml_line_count) {
603
+
bool strict = true;
604
+
OPTION_TO_BOOL(strict, strict, true);
605
+
606
+
if (line < 0 || (line > buf->b_ml.ml_line_count && strict)) {
600
607
api_set_error(err, kErrorTypeValidation, "line value outside range");
601
608
goto error;
602
609
} else if (line < buf->b_ml.ml_line_count) {
@@ -605,7 +612,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
605
612
606
613
if (col == -1) {
607
614
col = (Integer)len;
608
-
} else if (col < -1 || col > (Integer)len) {
615
+
} else if (col < -1 || (col > (Integer)len && strict)) {
609
616
api_set_error(err, kErrorTypeValidation, "col value outside range");
610
617
goto error;
611
618
}
@@ -620,7 +627,7 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id, Integer line, Integer
620
627
// reuse len from before
621
628
line2 = (int)line;
622
629
}
623
-
if (col2 > (Integer)len) {
630
+
if (col2 > (Integer)len && strict) {
624
631
api_set_error(err, kErrorTypeValidation, "end_col value outside range");
625
632
goto error;
626
633
}
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ return {
21
21
"virt_lines";
22
22
"virt_lines_above";
23
23
"virt_lines_leftcol";
24
+
"strict";
24
25
};
25
26
keymap = {
26
27
"noremap";
You can’t perform that action at this time.
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