1 | /****************************** Module Header *******************************
|
---|
2 | *
|
---|
3 | * Module Name: swaptext.e
|
---|
4 | *
|
---|
5 | * Copyright (c) Netlabs EPM Distribution Project 2002
|
---|
6 | *
|
---|
7 | * $Id: swaptext.e 2417 2011-05-15 23:32:51Z aschn $
|
---|
8 | *
|
---|
9 | * ===========================================================================
|
---|
10 | *
|
---|
11 | * This file is part of the Netlabs EPM Distribution package and is free
|
---|
12 | * software. You can redistribute it and/or modify it under the terms of the
|
---|
13 | * GNU General Public License as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * Netlabs EPM Distribution. This library is distributed in the hope that it
|
---|
16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
---|
17 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
18 | * General Public License for more details.
|
---|
19 | *
|
---|
20 | ****************************************************************************/
|
---|
21 |
|
---|
22 | defc MoveLineUp
|
---|
23 | if .last < 2 then
|
---|
24 | return
|
---|
25 | endif
|
---|
26 | saved_autosave = .autosave
|
---|
27 | .autosave = 0
|
---|
28 | call DisableUndoRec()
|
---|
29 | getline line
|
---|
30 | l = max( .line - 1, 1)
|
---|
31 | deleteline
|
---|
32 | insertline line, l -- insert above
|
---|
33 | .lineg = l -- go to line l without scrolling
|
---|
34 | .line = l -- scroll when outside of window
|
---|
35 | .autosave = saved_autosave
|
---|
36 | return
|
---|
37 |
|
---|
38 | defc MoveLineDown
|
---|
39 | if .last < 2 then
|
---|
40 | return
|
---|
41 | endif
|
---|
42 | saved_autosave = .autosave
|
---|
43 | .autosave = 0
|
---|
44 | call DisableUndoRec()
|
---|
45 | col = .col
|
---|
46 | getline line
|
---|
47 | deleteline
|
---|
48 | insertline line, .line + 1 -- insert below
|
---|
49 | down
|
---|
50 | .col = col
|
---|
51 | .autosave = saved_autosave
|
---|
52 | return
|
---|
53 |
|
---|
54 | defc MoveCharLeft
|
---|
55 | saved_autosave = .autosave
|
---|
56 | .autosave = 0
|
---|
57 | call DisableUndoRec()
|
---|
58 | if not insert_state() then
|
---|
59 | -- switch to insert mode
|
---|
60 | insert_toggle
|
---|
61 | foverwrite = 1
|
---|
62 | else
|
---|
63 | foverwrite = 0
|
---|
64 | endif
|
---|
65 | getline line
|
---|
66 | char = substr( line, .col, 1)
|
---|
67 | deletechar
|
---|
68 | left
|
---|
69 | keyin char
|
---|
70 | left
|
---|
71 | if foverwrite then
|
---|
72 | insert_toggle
|
---|
73 | endif
|
---|
74 | .autosave = saved_autosave
|
---|
75 | return
|
---|
76 |
|
---|
77 | defc MoveCharRight
|
---|
78 | saved_autosave = .autosave
|
---|
79 | .autosave = 0
|
---|
80 | call DisableUndoRec()
|
---|
81 | if not insert_state() then
|
---|
82 | -- switch to insert mode
|
---|
83 | insert_toggle
|
---|
84 | foverwrite = 1
|
---|
85 | else
|
---|
86 | foverwrite = 0
|
---|
87 | endif
|
---|
88 | getline line
|
---|
89 | char = substr( line, .col, 1)
|
---|
90 | deletechar
|
---|
91 | right
|
---|
92 | keyin char
|
---|
93 | left
|
---|
94 | if foverwrite then
|
---|
95 | insert_toggle
|
---|
96 | endif
|
---|
97 | .autosave = saved_autosave
|
---|
98 | return
|
---|
99 |
|
---|