Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
karudu
/
C-editor
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ee23d7ee
authored
Apr 21, 2022
by
castro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
non crashable search.c
parent
931a6ca8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
9 deletions
search.c
search.c
View file @
ee23d7ee
...
...
@@ -30,12 +30,9 @@ void asenda (GtkTextView *text_view, const gchar *replace, const gchar *text, Gt
if
(
found
)
{
gtk_text_buffer_select_range
(
buffer
,
&
mstart
,
&
mend
);
last_pos
=
gtk_text_buffer_create_mark
(
buffer
,
"last_pos"
,
&
mend
,
FALSE
);
gtk_text_view_scroll_mark_onscreen
(
text_view
,
last_pos
);
}
gtk_text_buffer_delete
(
buffer
,
&
mstart
,
&
mend
);
gtk_text_buffer_insert
(
buffer
,
&
mstart
,
replace
,
-
1
);
}
}
// funktsioon selleks kui search nuppu vajutatakse
void
Otsi_nupp_vajutatud
(
GtkWidget
*
search_button
,
tab
*
Tab
)
...
...
@@ -62,8 +59,8 @@ void Jargmine_nupp_vajutatud (GtkWidget *next_button, tab *Tab)
text
=
gtk_entry_get_text
(
GTK_ENTRY
(
Tab
->
search_entry
));
buffer
=
gtk_text_view_get_buffer
(
GTK_TEXT_VIEW
(
Tab
->
TextView
));
last_pos
=
gtk_text_buffer_get_mark
(
buffer
,
"last_pos"
);
if
(
last_pos
==
NULL
)
return
;
...
...
@@ -76,20 +73,19 @@ void Asenda_nupp_vajutatud (GtkWidget *asenda_nupp, tab *Tab)
const
gchar
*
text
,
*
replace
;
GtkTextBuffer
*
buffer
;
GtkTextMark
*
last_pos
;
GtkTextIter
*
mstart
,
*
mend
,
iter
;
gboolean
found
;
GtkTextIter
iter
;
text
=
gtk_entry_get_text
(
GTK_ENTRY
(
Tab
->
search_entry
));
replace
=
gtk_entry_get_text
(
GTK_ENTRY
(
Tab
->
replace_entry
));
buffer
=
gtk_text_view_get_buffer
(
GTK_TEXT_VIEW
(
Tab
->
TextView
));
gtk_text_buffer_get_start_iter
(
buffer
,
&
iter
);
last_pos
=
gtk_text_buffer_get_mark
(
buffer
,
"last_pos"
);
if
(
last_pos
==
NULL
)
return
;
gtk_text_buffer_get_start_iter
(
buffer
,
&
iter
);
asenda
(
GTK_TEXT_VIEW
(
Tab
->
TextView
),
replace
,
text
,
&
iter
);
//gtk_text_buffer_insert (buffer, mstart, replace, -1);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment