1
1
local D = require (" text-transform.utils.debug" )
2
- local state = require (" text-transform.state" )
2
+ local S = require (" text-transform.state" )
3
3
local t = require (" text-transform.transformers" )
4
4
5
5
local TextTransform = {}
@@ -153,32 +153,32 @@ end
153
153
--- This allows to treat all ranges equally and allows to work on each selection without knowing
154
154
--- the full information around the selection logic.
155
155
function TextTransform .get_visual_selection_details ()
156
- if not state .state .positions then
156
+ if not S .state .positions . pos then
157
157
D .log (" get_visual_selection_details" , " No positions saved" )
158
158
return {}
159
159
end
160
160
D .log (
161
161
" get_visual_selection_details" ,
162
162
" Getting visual selection details - mode: %s, is_visual: %s, is_block: %s" ,
163
- state .state . positions .mode ,
164
- state .is_visual_mode (),
165
- state .is_block_visual_mode ()
163
+ S .state .mode ,
164
+ S .is_visual_mode (),
165
+ S .is_block_visual_mode ()
166
166
)
167
167
168
168
-- Get the start and end positions of the selection
169
- local start_pos = state .state .positions .visual_start
170
- local end_pos = state .state .positions .visual_end
169
+ local start_pos = S .state .positions .visual_start
170
+ local end_pos = S .state .positions .visual_end
171
171
local start_line , start_col = start_pos [2 ], start_pos [3 ]
172
172
local end_line , end_col = end_pos [2 ], end_pos [3 ]
173
173
174
174
-- Check if currently in visual mode; if not, return the cursor position
175
175
if
176
- not state .is_visual_mode ()
177
- and not state .is_block_visual_mode ()
178
- and not state .has_range (start_pos , end_pos )
176
+ not S .is_visual_mode ()
177
+ and not S .is_block_visual_mode ()
178
+ and not S .has_range (start_pos , end_pos )
179
179
then
180
- local pos = state . positions . pos
181
- D . log ( " get_visual_selection_details " , " Returning single cursor position " )
180
+ D . log ( " get_visual_selection_details " , " Returning single cursor position: " .. vim . inspect ( S ))
181
+ local pos = S . state . positions . pos
182
182
return {
183
183
{
184
184
start_line = pos [2 ],
@@ -196,7 +196,7 @@ function TextTransform.get_visual_selection_details()
196
196
end
197
197
198
198
-- If it's block visual mode, return table for each row
199
- if state .is_block_visual_mode () or state .has_range (start_pos , end_pos ) then
199
+ if S .is_block_visual_mode () or S .has_range (start_pos , end_pos ) then
200
200
local block_selection = {}
201
201
for line = start_line , end_line do
202
202
if start_col == end_col then
0 commit comments