File: 029-textbuffer.lua

package info (click to toggle)
lua-gtk 0.9%2B20100528-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,176 kB
  • ctags: 1,934
  • sloc: ansic: 9,571; sh: 373; makefile: 241
file content (31 lines) | stat: -rwxr-xr-x 587 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /usr/bin/env lua
-- vim:sw=4:sts=4

require "gtk"

buf = gtk.text_buffer_new(nil)

-- no problem
m1 = buf:get_insert()
m2 = buf:get_insert()
m3 = buf:get_insert()

-- no problem
iter = gtk.new "TextIter"
buf:get_start_iter(iter)

-- this used to cause a segfault, but is fixed as of 2008-07-16
m4 = gtk.text_mark_new("mark1", true)
buf:add_mark(m4, iter)

m4 = buf:get_mark("mark1")

m5 = buf:create_mark("mark2", iter, true)

-- test text tags
t1 = buf:create_tag('foo', 'foreground', 'blue', nil)
assert(t1)
t2 = buf:create_tag('foo', 'foreground', 'blue', nil)
assert(t2 == nil)