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
8b0639a5
authored
Apr 20, 2022
by
castro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lisatud algne asendamine.
parent
41cc8271
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
47 deletions
search.c
search.c
View file @
8b0639a5
#include "search.h"
#include "ceditor.h"
#include "ui.h"
void
find
(
GtkTextView
*
text_view
,
const
gchar
*
text
,
GtkTextIter
*
iter
)
/* TODO
{
Klahvikombinatsioonid
GtkTextIter
mstart
,
mend
;
*/
GtkTextBuffer
*
buffer
;
GtkTextMark
*
last_pos
;
gboolean
found
;
buffer
=
gtk_text_view_get_buffer
(
GTK_TEXT_VIEW
(
text_view
));
found
=
gtk_text_iter_forward_search
(
iter
,
text
,
0
,
&
mstart
,
&
mend
,
NULL
);
if
(
found
)
int
main
(
int
argc
,
char
**
argv
)
{
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
);
}
}
// funktsioon selleks kui search nuppu vajutatakse
void
Otsi_nupp_vajutatud
(
GtkWidget
*
search_button
,
tab
*
Tab
)
{
{
const
gchar
*
text
;
gtk_init
(
&
argc
,
&
argv
);
GtkTextBuffer
*
buffer
;
GtkTextIter
iter
;
text
=
gtk_entry_get_text
(
GTK_ENTRY
(
Tab
->
search_entry
));
ui
*
UI
=
LooUI
();
gtk_widget_show_all
(
UI
->
Aken
);
// Näita akent
buffer
=
gtk_text_view_get_buffer
(
GTK_TEXT_VIEW
(
Tab
->
TextView
));
gtk_main
();
gtk_text_buffer_get_start_iter
(
buffer
,
&
iter
);
find
(
GTK_TEXT_VIEW
(
Tab
->
TextView
),
text
,
&
iter
)
;
return
0
;
}
}
// funktsioon selleks kui jargmine_nupp vajutatakse
void
Jargmine_nupp_vajutatud
(
GtkWidget
*
next_button
,
tab
*
Tab
)
{
const
gchar
*
text
;
GtkTextBuffer
*
buffer
;
GtkTextMark
*
last_pos
;
GtkTextIter
iter
;
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
;
gtk_text_buffer_get_iter_at_mark
(
buffer
,
&
iter
,
last_pos
);
find
(
GTK_TEXT_VIEW
(
Tab
->
TextView
),
text
,
&
iter
);
}
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