本文整理匯總了Golang中github.com/mattn/go-gtk/gtk.TextIter.ForwardSearch方法的典型用法代碼示例。如果您正苦於以下問題:Golang TextIter.ForwardSearch方法的具體用法?Golang TextIter.ForwardSearch怎麽用?Golang TextIter.ForwardSearch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/mattn/go-gtk/gtk.TextIter
的用法示例。
在下文中一共展示了TextIter.ForwardSearch方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: mark_set_cb
func mark_set_cb() {
var cur gtk.TextIter
var be, en gtk.TextIter
source_buf.GetSelectionBounds(&be, &en)
selection := source_buf.GetSlice(&be, &en, false)
if prev_selection == selection {
return
}
prev_selection = selection
if selection_flag {
source_buf.GetStartIter(&be)
source_buf.GetEndIter(&en)
source_buf.RemoveTagByName("instance", &be, &en)
selection_flag = false
}
sel_len := len(selection)
if (sel_len <= 1) || (sel_len >= MAX_SEL_LEN) {
return
} else {
selection_flag = true
}
source_buf.GetStartIter(&cur)
for cur.ForwardSearch(selection, 0, &be, &cur, nil) {
source_buf.ApplyTagByName("instance", &be, &cur)
}
}
示例2: find_next_instance
func find_next_instance(start, be, en *gtk.TextIter, pattern string) bool {
if start.ForwardSearch(pattern, 0, be, en, nil) {
return true
}
source_buf.GetStartIter(be)
return be.ForwardSearch(pattern, 0, be, en, nil)
}
示例3: fnr_find_next
func fnr_find_next(pattern string, global bool, map_filled *bool, m *map[string]int) bool {
var be, en, scope_en gtk.TextIter
get_iter_at_mark_by_name("fnr_en", &scope_en)
get_iter_at_mark_by_name("selection_bound", &en)
if en.ForwardSearch(pattern, 0, &be, &en, &scope_en) {
move_focus_and_selection(&be, &en)
return true
}
// Have to switch to next file or to beginning of current depending on <global>.
if global {
// Switch to next file.
fnr_find_next_fill_global_map(pattern, m, map_filled)
next_file := pop_string_from_map(m)
if "" == next_file {
return false
}
file_save_current()
file_switch_to(next_file)
fnr_refresh_scope(true)
source_buf.GetStartIter(&be)
source_buf.MoveMarkByName("insert", &be)
source_buf.MoveMarkByName("selection_bound", &be)
return fnr_find_next(pattern, global, map_filled, m)
} else {
// Temporary fix. Is there necessity to search the document all over again?
return false
// Start search from beginning of scope.
// get_iter_at_mark_by_name("fnr_be", &be)
// if be.ForwardSearch(pattern, 0, &be, &en, &scope_en) {
// move_focus_and_selection(&be, &en)
// return true
//} else {
// return false
//}
}
return false
}