@@ -17,26 +17,24 @@ local convert_all = function(bufnr, from, to)
1717 to_type = ' size'
1818 end
1919 if from_type ~= to_type then
20- print (string.format (" Can't convert %s to %s units" , from_type , to_type ))
2120 return
2221 end
2322
2423 local lines = vim .api .nvim_buf_get_lines (bufnr , 0 , - 1 , false )
25- local all_units = utils .find_all_units_in_line (line , row )
26- if all_units ~= nil and # all_units > 0 and all_units [1 ].unit == from then
27- for i = # all_units , 1 , - 1 do
28- local found = all_units [i ]
29- local converted = calculator .convert (from , to , found .val )
24+ local all_units = utils .find_all_units_in_line (line , row )
25+ if all_units ~= nil and # all_units > 0 and all_units [1 ].unit == from then
26+ for i = # all_units , 1 , - 1 do
27+ local found = all_units [i ]
28+ local converted = calculator .convert (from , to , found .val )
3029
31- vim .api .nvim_buf_set_text (
32- bufnr ,
33- found .pos .row - 1 ,
34- found .pos .start_col - 1 ,
35- found .pos .row - 1 ,
36- found .pos .end_col ,
37- { converted }
38- )
39- end
30+ vim .api .nvim_buf_set_text (
31+ bufnr ,
32+ found .pos .row - 1 ,
33+ found .pos .start_col - 1 ,
34+ found .pos .row - 1 ,
35+ found .pos .end_col ,
36+ { converted }
37+ )
4038 end
4139 end
4240end
0 commit comments