@@ -13,6 +13,7 @@ public class Jorts.TextView : Granite.HyperTextView {
1313
1414 private Gtk . EventControllerKey keyboard;
1515 private string list_item_start;
16+ public bool on_list_item {public get ; private set ;}
1617
1718 public string text {
1819 owned get {return buffer. text;}
@@ -31,14 +32,16 @@ public class Jorts.TextView : Granite.HyperTextView {
3132 set_wrap_mode (Gtk . WrapMode . WORD_CHAR );
3233
3334 list_item_start = Application . gsettings. get_string (" list-item-start" );
34- // Application.gsettings.bind ( "list-item-start", this, "list-item-start", GLib.SettingsBindFlags.GET );
35+ Application . gsettings. changed[ " list-item-start" ] . connect (on_prefix_changed );
3536
3637 keyboard = new Gtk .EventControllerKey ();
3738 add_controller (keyboard);
3839 keyboard. key_pressed. connect (on_key_pressed);
3940
40- move_cursor. connect (on_cursor_changed);
41- Application . gsettings. changed[" list-item-start" ]. connect (on_prefix_changed);
41+ // TODO: Buggy. Clicking anywhere brings it out of whack
42+ // on_cursor_changed ();
43+ // move_cursor.connect_after (on_cursor_changed);
44+
4245 }
4346
4447 public void paste () {
@@ -203,11 +206,10 @@ public class Jorts.TextView : Granite.HyperTextView {
203206 private void on_cursor_changed () {
204207 Gtk . TextIter start, end;
205208 buffer. get_selection_bounds (out start, out end);
206- start. backward_line ();
207209 var line_number = (uint8 )start. get_line ();
208210
209- if ( this . has_prefix (line_number)) {
210- print ( " YES THIS IS LIST " );
211- }
211+ on_list_item = this . has_prefix (line_number);
212+
213+ print ( " THIS IS LIST. HAS " + on_list_item . to_string () + " ON LINE " + line_number . to_string ());
212214 }
213215}
0 commit comments