about summary refs log tree commit diff stats
path: root/src/local
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-08-09 16:47:29 +0200
committerbptato <nincsnevem662@gmail.com>2024-08-09 16:51:35 +0200
commit4d6c8ad147cb73ca4e9d3fa3db7eb919100a1f63 (patch)
treed4e108d7672ca6f425c2f38577a7a93fdf7e4eb4 /src/local
parentf0271169424377626d58547a21b0da3251a6a2c7 (diff)
downloadchawan-4d6c8ad147cb73ca4e9d3fa3db7eb919100a1f63.tar.gz
pager: fix <select> drawing after container redraw
Diffstat (limited to 'src/local')
-rw-r--r--src/local/container.nim2
-rw-r--r--src/local/pager.nim2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/local/container.nim b/src/local/container.nim
index 108c631e..de4a78ff 100644
--- a/src/local/container.nim
+++ b/src/local/container.nim
@@ -1849,7 +1849,7 @@ proc displaySelect(container: Container; selectResult: SelectResult) =
     opt.mnormalize()
     container.select.maxw = max(container.select.maxw, opt.width())
   container.select.windowChange(container.height)
-  container.queueDraw()
+  container.select.queueDraw()
 
 proc onclick(container: Container; res: ClickResult; save: bool) =
   if res.repaint:
diff --git a/src/local/pager.nim b/src/local/pager.nim
index 79fe0e79..f39174a9 100644
--- a/src/local/pager.nim
+++ b/src/local/pager.nim
@@ -596,6 +596,8 @@ proc draw*(pager: Pager) =
       container.redraw = false
       pager.display.redraw = true
       imageRedraw = true
+      if container.select != nil:
+        container.select.redraw = true
     if (let select = container.select; select != nil and select.redraw):
       select.drawSelect(pager.display.grid)
       select.redraw = false
&id=1848b18f02b158861008214efd19708585bfcbe5'>1848b18f ^
f2818edc ^
363be37f ^
f2818edc ^

e4630643 ^







dc1323e9 ^
1066660e ^
35064671 ^
1066660e ^
f2818edc ^

6f8f9fb5 ^

363be37f ^
f2818edc ^
88be3dbc ^
f2818edc ^
100157d1 ^
d7494165 ^
100157d1 ^


d7494165 ^


201b2e6c ^
1848b18f ^

201b2e6c ^
363be37f ^
201b2e6c ^

e4630643 ^











dc1323e9 ^
0487a30e ^
35064671 ^
201b2e6c ^

1066660e ^
35064671 ^
1066660e ^
201b2e6c ^

88be3dbc ^
201b2e6c ^
bc643692 ^

201b2e6c ^
bc643692 ^
201b2e6c ^
bc643692 ^
d7494165 ^
201b2e6c ^
88be3dbc ^
201b2e6c ^
bc643692 ^

201b2e6c ^
bc643692 ^
201b2e6c ^
bc643692 ^
57699011 ^
201b2e6c ^
1848b18f ^

201b2e6c ^
363be37f ^
201b2e6c ^

e4630643 ^











dc1323e9 ^
0487a30e ^
35064671 ^
201b2e6c ^

1066660e ^
35064671 ^
1066660e ^
201b2e6c ^

88be3dbc ^
201b2e6c ^
bc643692 ^

201b2e6c ^
bc643692 ^
201b2e6c ^
bc643692 ^
d7494165 ^
201b2e6c ^
88be3dbc ^
201b2e6c ^
bc643692 ^

201b2e6c ^
bc643692 ^
201b2e6c ^
bc643692 ^
57699011 ^
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
                   
 
                                      
                                           

               
                    
 
                   
                        

                             
                                             
     
                                        
                              

                                                







                                                                                                                                                                                       
                                                              
                                                    
                                                                                                     
                                             

 

                                          
                           
 
                         
             
                       
                               


                               


                    
 

                                             
                                        
                                    

                                                











                                                                                                                                                                                               
                                                              
                                 
                                                                            

          
                                                    
                                                                                                     
                                             

 
                   
             

                       
 
                           
                              
                        
                               
 
                               
             

                      
 
                         
                          
                          
                               
 

                                             
                                        
                                            

                                                











                                                                                                                                                                                                   
                                                              
                                
                                                                                

          
                                                    
                                                                                                     
                                             

 
                       
             

                         
 
                             
                              
                          
                               
 
                                   
             

                           
 
                               
                              
                          
                               
//: Jump primitives

:(scenario jump_can_skip_instructions)
#? % Trace_stream->dump_layer = "all"; #? 1
recipe main [
  jump 1:offset
  1:number <- copy 1
]
+run: jump 1:offset
-run: 1:number <- copy 1
-mem: storing 1 in location 1

:(before "End Primitive Recipe Declarations")
JUMP,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["jump"] = JUMP;
:(before "End Primitive Recipe Implementations")
case JUMP: {
  if (SIZE(ingredients) != 1) {
    raise << current_recipe_name() << ": 'jump' requires exactly one ingredient, but got " << current_instruction().to_string() << '\n' << end();
    break;
  }
  if (!scalar(ingredients.at(0))) {
    raise << current_recipe_name() << ": first ingredient of 'jump' should be a label or offset, but got " << current_instruction().ingredients.at(0).original_string << '\n' << end();
    break;
  }
  assert(current_instruction().ingredients.at(0).initialized);
  current_step_index() += ingredients.at(0).at(0)+1;
  trace(Primitive_recipe_depth, "run") << "jumping to instruction " << current_step_index() << end();
  continue;  // skip rest of this instruction
}

//: special type to designate jump targets
:(before "End Mu Types Initialization")
Type_ordinal["offset"] = 0;

:(scenario jump_backward)
recipe main [
  jump 1:offset  # 0 -+
  jump 3:offset  #    |   +-+ 1
                 #   \/  /\ |
  jump -2:offset #  2 +-->+ |
]                #         \/ 3
+run: jump 1:offset
+run: jump -2:offset
+run: jump 3:offset

:(before "End Primitive Recipe Declarations")
JUMP_IF,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["jump-if"] = JUMP_IF;
:(before "End Primitive Recipe Implementations")
case JUMP_IF: {
  if (SIZE(ingredients) != 2) {
    raise << current_recipe_name() << ": 'jump-if' requires exactly two ingredients, but got " << current_instruction().to_string() << '\n' << end();
    break;
  }
  if (!scalar(ingredients.at(0))) {
    raise << current_recipe_name() << ": 'jump-if' requires a boolean for its first ingredient, but got " << current_instruction().ingredients.at(0).original_string << '\n' << end();
    break;
  }
  if (!scalar(ingredients.at(1))) {
    raise << current_recipe_name() << ": 'jump-if' requires a label or offset for its second ingredient, but got " << current_instruction().ingredients.at(0).original_string << '\n' << end();
    break;
  }
  assert(current_instruction().ingredients.at(1).initialized);
  if (!ingredients.at(0).at(0)) {
    trace(Primitive_recipe_depth, "run") << "jump-if fell through" << end();
    break;
  }
  current_step_index() += ingredients.at(1).at(0)+1;
  trace(Primitive_recipe_depth, "run") << "jumping to instruction " << current_step_index() << end();
  continue;  // skip rest of this instruction
}

:(scenario jump_if)
recipe main [
  jump-if 999, 1:offset
  123:number <- copy 1
]
+run: jump-if 999, 1:offset
+run: jumping to instruction 2
-run: 1:number <- copy 1
-mem: storing 1 in location 123

:(scenario jump_if_fallthrough)
recipe main [
  jump-if 0, 1:offset
  123:number <- copy 1
]
+run: jump-if 0, 1:offset
+run: jump-if fell through
+run: 123:number <- copy 1
+mem: storing 1 in location 123

:(before "End Primitive Recipe Declarations")
JUMP_UNLESS,
:(before "End Primitive Recipe Numbers")
Recipe_ordinal["jump-unless"] = JUMP_UNLESS;
:(before "End Primitive Recipe Implementations")
case JUMP_UNLESS: {
  if (SIZE(ingredients) != 2) {
    raise << current_recipe_name() << ": 'jump-unless' requires exactly two ingredients, but got " << current_instruction().to_string() << '\n' << end();
    break;
  }
  if (!scalar(ingredients.at(0))) {
    raise << current_recipe_name() << ": 'jump-unless' requires a boolean for its first ingredient, but got " << current_instruction().ingredients.at(0).original_string << '\n' << end();
    break;
  }
  if (!scalar(ingredients.at(1))) {
    raise << current_recipe_name() << ": 'jump-unless' requires a label or offset for its second ingredient, but got " << current_instruction().ingredients.at(0).original_string << '\n' << end();
    break;
  }
  assert(current_instruction().ingredients.at(1).initialized);
  if (ingredients.at(0).at(0)) {
    trace(Primitive_recipe_depth, "run") << "jump-unless fell through" << end();
    break;
  }
  current_step_index() += ingredients.at(1).at(0)+1;
  trace(Primitive_recipe_depth, "run") << "jumping to instruction " << current_step_index() << end();
  continue;  // skip rest of this instruction
}

:(scenario jump_unless)
recipe main [
  jump-unless 0, 1:offset
  123:number <- copy 1
]
+run: jump-unless 0, 1:offset
+run: jumping to instruction 2
-run: 123:number <- copy 1
-mem: storing 1 in location 123

:(scenario jump_unless_fallthrough)
recipe main [
  jump-unless 999, 1:offset
  123:number <- copy 1
]
+run: jump-unless 999, 1:offset
+run: jump-unless fell through
+run: 123:number <- copy 1
+mem: storing 1 in location 123