Skip to content

Commit 8419c46

Browse files
committed
fix program window
1 parent 3d8e787 commit 8419c46

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

TODO

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66

77
- test Mono / Monospace thing
88

9-
- program window, new tool, enter
10-
11-
fred = 12
12-
13-
process ... does nothing!
14-
159
- didn't we have band_and or equivalent somewhere?
1610

1711
band x = foldr1 bitwise_and (bandsplit x)
@@ -20,8 +14,6 @@
2014

2115
- breadcrumb trail for prog window, so you can get back to where you were?
2216

23-
- click away from a half-edited def should save somewhere?
24-
2517
- im_invertlut() as a menu item
2618

2719
handy for inverting the results of cum/norm/etc.

src/program.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,15 @@ program_text_cursor_position( GtkTextBuffer *buffer, GParamSpec *pspec,
893893
}
894894
}
895895

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+
896905
static void
897906
program_set_text( Program *program, const char *text, gboolean editable )
898907
{
@@ -1090,7 +1099,8 @@ program_parse( Program *program )
10901099
}
10911100

10921101
program->dirty = FALSE;
1093-
filemodel_set_modified( FILEMODEL( program->kit ), TRUE );
1102+
if( program->kit )
1103+
filemodel_set_modified( FILEMODEL( program->kit ), TRUE );
10941104

10951105
/* Reselect last_sym, the last thing the parser saw.
10961106
*/
@@ -1107,7 +1117,8 @@ program_tool_new_action_cb( GtkAction *action, Program *program )
11071117
{
11081118
/* Existing text changed? Parse it.
11091119
*/
1110-
if( program->dirty && !program_parse( program ) ) {
1120+
if( program->dirty &&
1121+
!program_parse( program ) ) {
11111122
iwindow_alert( GTK_WIDGET( program ), GTK_MESSAGE_ERROR );
11121123
return;
11131124
}
@@ -2358,6 +2369,11 @@ program_build( Program *program, GtkWidget *vbox )
23582369
gtk_text_view_get_buffer( GTK_TEXT_VIEW( program->text ) ),
23592370
"notify::cursor-position",
23602371
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+
23612377
gtk_container_add( GTK_CONTAINER( swin ), program->text );
23622378
gtk_widget_show( program->text );
23632379

0 commit comments

Comments
 (0)