@@ -70,7 +70,7 @@ module Crysterm
70
70
# ::Log.trace { line } if line.any? &.char.!=(' ')
71
71
72
72
# Skip if no change in line
73
- if ( !line.dirty && ! (c.artificial? && (y == tput.cursor.y) ))
73
+ if ! line.dirty && ! (c.artificial? && (y == tput.cursor.y))
74
74
next
75
75
end
76
76
@@ -92,7 +92,7 @@ module Crysterm
92
92
desired_char = line[x].char
93
93
94
94
# Render the artificial cursor.
95
- if ( c.artificial? && ! c._hidden && (c._state != 0 ) && (x == tput.cursor.x) && (y == tput.cursor.y) )
95
+ if c.artificial? && ! c._hidden && (c._state != 0 ) && (x == tput.cursor.x) && (y == tput.cursor.y)
96
96
desired_attr, tmpch = _artificial_cursor_attr(c, desired_attr)
97
97
desired_char = tmpch if tmpch
98
98
# XXX Is this needed:
@@ -101,9 +101,9 @@ module Crysterm
101
101
# Take advantage of xterm's back_color_erase feature by using a
102
102
# lookahead. Stop spitting out so many damn spaces. NOTE: Is checking
103
103
# the bg for non BCE terminals worth the overhead?
104
- if ( @optimization .bce? && (desired_char == ' ' ) &&
104
+ if @optimization .bce? && (desired_char == ' ' ) &&
105
105
(tput.has?(& .back_color_erase?) || ((desired_attr & 0x1ff ) == (@default_attr & 0x1ff ))) &&
106
- (((desired_attr >> 18 ) & 8 ) == ((@default_attr >> 18 ) & 8 )))
106
+ (((desired_attr >> 18 ) & 8 ) == ((@default_attr >> 18 ) & 8 ))
107
107
clr = true
108
108
neq = false # Current line 'not equal' to line as it was on previous render (i.e. it changed content)
109
109
@@ -226,34 +226,34 @@ module Crysterm
226
226
227
227
flags = desired_attr >> 18
228
228
# bold
229
- if (( flags & 1 ) != 0 )
229
+ if (flags & 1 ) != 0
230
230
@outbuf .print " 1;"
231
231
end
232
232
233
233
# underline
234
- if (( flags & 2 ) != 0 )
234
+ if (flags & 2 ) != 0
235
235
@outbuf .print " 4;"
236
236
end
237
237
238
238
# blink
239
- if (( flags & 4 ) != 0 )
239
+ if (flags & 4 ) != 0
240
240
@outbuf .print " 5;"
241
241
end
242
242
243
243
# inverse
244
- if (( flags & 8 ) != 0 )
244
+ if (flags & 8 ) != 0
245
245
@outbuf .print " 7;"
246
246
end
247
247
248
248
# invisible
249
- if (( flags & 16 ) != 0 )
249
+ if (flags & 16 ) != 0
250
250
@outbuf .print " 8;"
251
251
end
252
252
253
- if ( bg != 0x1ff )
253
+ if bg != 0x1ff
254
254
bg = _reduce_color(bg)
255
- if ( bg < 16 )
256
- if ( bg < 8 )
255
+ if bg < 16
256
+ if bg < 8
257
257
bg += 40
258
258
else # elsif (bg < 16)
259
259
bg -= 8
@@ -265,10 +265,10 @@ module Crysterm
265
265
end
266
266
end
267
267
268
- if ( fg != 0x1ff )
268
+ if fg != 0x1ff
269
269
fg = _reduce_color(fg)
270
- if ( fg < 16 )
271
- if ( fg < 8 )
270
+ if fg < 16
271
+ if fg < 8
272
272
fg += 30
273
273
else # elsif (fg < 16)
274
274
fg -= 8
@@ -339,7 +339,7 @@ module Crysterm
339
339
# case that the contents of the IF/ELSE block change in incompatible
340
340
# way, this should be had in mind.
341
341
if s
342
- if ( s.enter_alt_charset_mode? && ! tput.features.broken_acs? && (tput.features.acscr[desired_char]? || acs) )
342
+ if s.enter_alt_charset_mode? && ! tput.features.broken_acs? && (tput.features.acscr[desired_char]? || acs)
343
343
# Fun fact: even if tput.brokenACS wasn't checked here,
344
344
# the linux console would still work fine because the acs
345
345
# table would fail the check of: tput.features.acscr[desired_char]
@@ -380,7 +380,7 @@ module Crysterm
380
380
# Note: It could be the case that the $LANG
381
381
# is all that matters in some cases:
382
382
# if (!tput.unicode && desired_char > '~') {
383
- if ( !tput.features.unicode? && (tput.terminfo.try(& .extensions.get_num?(" U8" )) != 1 ) && (desired_char > '~' ) )
383
+ if ! tput.features.unicode? && (tput.terminfo.try(& .extensions.get_num?(" U8" )) != 1 ) && (desired_char > '~' )
384
384
# Reduction of ACS into ASCII chars.
385
385
desired_char = Tput ::ACSC ::Data [desired_char]?.try(& .[2 ]) || '?'
386
386
end
@@ -403,7 +403,7 @@ module Crysterm
403
403
end
404
404
end
405
405
406
- if ( acs)
406
+ if acs
407
407
@main .write s.rmacs
408
408
acs = false
409
409
end
@@ -460,9 +460,9 @@ module Crysterm
460
460
# return insert_line_nc(n, y, top, bottom)
461
461
# end
462
462
463
- if ( !tput.has?(& .change_scroll_region?) ||
463
+ if ! tput.has?(& .change_scroll_region?) ||
464
464
! tput.has?(& .delete_line?) ||
465
- ! tput.has?(& .insert_line?))
465
+ ! tput.has?(& .insert_line?)
466
466
STDERR .puts " Missing needed terminfo capabilities"
467
467
return
468
468
end
@@ -493,8 +493,8 @@ module Crysterm
493
493
# Scroll down (up cursor-wise).
494
494
# This will only work for top line deletion as opposed to arbitrary lines.
495
495
def insert_line_nc (n, y, top, bottom)
496
- if ( !tput.has?(& .change_scroll_region?) ||
497
- ! tput.has?(& .delete_line?))
496
+ if ! tput.has?(& .change_scroll_region?) ||
497
+ ! tput.has?(& .delete_line?)
498
498
STDERR .puts " Missing needed terminfo capabilities"
499
499
return
500
500
end
@@ -526,9 +526,9 @@ module Crysterm
526
526
# return delete_line_nc(n, y, top, bottom)
527
527
# end
528
528
529
- if ( !tput.has?(& .change_scroll_region?) ||
529
+ if ! tput.has?(& .change_scroll_region?) ||
530
530
! tput.has?(& .delete_line?) ||
531
- ! tput.has?(& .insert_line?))
531
+ ! tput.has?(& .insert_line?)
532
532
STDERR .puts " Missing needed terminfo capabilities"
533
533
return
534
534
end
@@ -560,8 +560,8 @@ module Crysterm
560
560
# Scroll down (up cursor-wise).
561
561
# This will only work for top line deletion as opposed to arbitrary lines.
562
562
def delete_line_nc (n, y, top, bottom)
563
- if ( !tput.has?(& .change_scroll_region?) ||
564
- ! tput.has?(& .delete_line?))
563
+ if ! tput.has?(& .change_scroll_region?) ||
564
+ ! tput.has?(& .delete_line?)
565
565
STDERR .puts " Missing needed terminfo capabilities"
566
566
return
567
567
end
0 commit comments