@@ -893,6 +893,15 @@ program_text_cursor_position( GtkTextBuffer *buffer, GParamSpec *pspec,
893
893
}
894
894
}
895
895
896
+ static void
897
+ program_text_changed ( GtkTextBuffer * buffer , Program * program )
898
+ {
899
+ if ( !program -> dirty ) {
900
+ program -> dirty = TRUE;
901
+ program_refresh ( program );
902
+ }
903
+ }
904
+
896
905
static void
897
906
program_set_text ( Program * program , const char * text , gboolean editable )
898
907
{
@@ -1090,7 +1099,8 @@ program_parse( Program *program )
1090
1099
}
1091
1100
1092
1101
program -> dirty = FALSE;
1093
- filemodel_set_modified ( FILEMODEL ( program -> kit ), TRUE );
1102
+ if ( program -> kit )
1103
+ filemodel_set_modified ( FILEMODEL ( program -> kit ), TRUE );
1094
1104
1095
1105
/* Reselect last_sym, the last thing the parser saw.
1096
1106
*/
@@ -1107,7 +1117,8 @@ program_tool_new_action_cb( GtkAction *action, Program *program )
1107
1117
{
1108
1118
/* Existing text changed? Parse it.
1109
1119
*/
1110
- if ( program -> dirty && !program_parse ( program ) ) {
1120
+ if ( program -> dirty &&
1121
+ !program_parse ( program ) ) {
1111
1122
iwindow_alert ( GTK_WIDGET ( program ), GTK_MESSAGE_ERROR );
1112
1123
return ;
1113
1124
}
@@ -2358,6 +2369,11 @@ program_build( Program *program, GtkWidget *vbox )
2358
2369
gtk_text_view_get_buffer ( GTK_TEXT_VIEW ( program -> text ) ),
2359
2370
"notify::cursor-position" ,
2360
2371
G_CALLBACK ( program_text_cursor_position ), program );
2372
+ g_signal_connect (
2373
+ gtk_text_view_get_buffer ( GTK_TEXT_VIEW ( program -> text ) ),
2374
+ "changed" ,
2375
+ G_CALLBACK ( program_text_changed ), program );
2376
+
2361
2377
gtk_container_add ( GTK_CONTAINER ( swin ), program -> text );
2362
2378
gtk_widget_show ( program -> text );
2363
2379
0 commit comments