Skip to content

Commit 9d79dcb

Browse files
committed
add granularity
1 parent 004f556 commit 9d79dcb

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

src/Widgets/TextView.vala

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,33 @@ public class Jorts.TextView : Granite.HyperTextView {
177177

178178
}
179179

180+
/**
181+
* Add the list prefix only to lines who hasnt it already
182+
*/
183+
private void set_list_at (int line) {
184+
Gtk.TextIter line_start;
185+
186+
buffer.get_iter_at_line_offset (out line_start, line, 0);
187+
var line_end = line_start.copy ();
188+
line_end.forward_to_line_end ();
189+
buffer.apply_tag (tag_list, line_start, line_end);
190+
191+
buffer.insert (ref line_start, "%s\t".printf (list_item_start), -1);
192+
}
193+
194+
195+
196+
private void remove_list_at (int line) {
197+
if (!has_prefix (line)) {
198+
return;
199+
}
200+
201+
Gtk.TextIter line_start;
202+
remove_prefix (line);
203+
}
204+
205+
206+
180207
/**
181208
* Remove list prefix from line x to line y. Presuppose it is there
182209
*/

0 commit comments

Comments
 (0)