expand-region.feature (10656B)
1 Feature: Expand Region 2 In order to quickly and precisely mark units 3 As an Emacs user 4 I want to expand to them 5 6 Scenario: Mark entire word with point midword 7 Given there is no region selected 8 When I insert "This is some text" 9 And I go to point "10" 10 And I press "C-@" 11 Then the region should be "some" 12 13 Scenario: Mark entire word with point midword, smart cursor 14 Given there is no region selected 15 And cursor behaviour is set to smart 16 When I insert "This is some text" 17 And I go to point "10" 18 And I press "C-@" 19 Then the region should be "some" 20 And cursor should be at point "13" 21 22 Scenario: Mark entire word with point at beginning of word, smart cursor 23 Given there is no region selected 24 And cursor behaviour is set to smart 25 When I insert "This is some text" 26 And I go to point "9" 27 And I press "C-@" 28 Then the region should be "some" 29 And cursor should be at point "9" 30 31 Scenario: Mark word just behind point 32 Given there is no region selected 33 When I insert "This is some text" 34 And I go to point "13" 35 And I press "C-@" 36 Then the region should be "some" 37 38 Scenario: Multiple expand-region 39 Given there is no region selected 40 When I insert "This (is some) text" 41 And I go to point "10" 42 And I press "C-@" 43 And I press "C-@" 44 And I press "C-@" 45 Then the region should be "(is some)" 46 47 Scenario: Expand from existing selection 48 Given there is no region selected 49 When I insert "This (is some) text" 50 And I go to point "7" 51 And I set the mark 52 And I go to point "14" 53 And I press "C-@" 54 Then the region should be "(is some)" 55 56 Scenario: Skip white space forward if spaces on both sides of cursor 57 Given there is no region selected 58 When I insert "This is some text" 59 And I go to point "10" 60 And I press "C-@" 61 Then the region should be "some" 62 63 Scenario: Skip white space forward if at beginning of buffer 64 Given there is no region selected 65 When I insert " This is some text" 66 And I go to beginning of buffer 67 And I press "C-@" 68 Then the region should be "This" 69 70 Scenario: Skip white space forward if at beginning of line 71 Given there is no region selected 72 When I insert: 73 """ 74 This is 75 some text 76 """ 77 And I go to point "9" 78 And I press "C-@" 79 Then the region should be "some" 80 81 Scenario: Do not skip white space forward with active region 82 Given there is no region selected 83 When I insert "This is some text" 84 And I go to point "10" 85 And I set the mark 86 And I go to point "14" 87 And I press "C-@" 88 Then the region should be "This is some text" 89 90 Scenario: Contract region once 91 Given there is no region selected 92 When I insert "(((45678)))" 93 And I go to point "6" 94 And I press "C-@" 95 And I press "C-@" 96 And I press "C-@" 97 And I press "C-S-@" 98 Then the region should be "(45678)" 99 100 Scenario: Contract region twice 101 Given there is no region selected 102 When I insert "(((45678)))" 103 And I go to point "6" 104 And I press "C-@" 105 And I press "C-@" 106 And I press "C-@" 107 And I press "C-S-@" 108 And I press "C-S-@" 109 Then the region should be "45678" 110 111 Scenario: Contract region twice, smart cursor, beginning of word 112 Given there is no region selected 113 And cursor behaviour is set to smart 114 When I insert "(((45678)))" 115 And I go to point "4" 116 And I press "C-@" 117 And I press "C-@" 118 And I press "C-@" 119 And I press "C-S-@" 120 And I press "C-S-@" 121 Then the region should be "45678" 122 And cursor should be at point "4" 123 124 Scenario: Contract region twice, smart cursor, midword 125 Given there is no region selected 126 And cursor behaviour is set to smart 127 When I insert "(((45678)))" 128 And I go to point "6" 129 And I press "C-@" 130 And I press "C-@" 131 And I press "C-@" 132 And I press "C-S-@" 133 And I press "C-S-@" 134 Then the region should be "45678" 135 And cursor should be at point "9" 136 137 Scenario: Contract region all the way back to start 138 Given there is no region selected 139 When I insert "(((45678)))" 140 And I go to point "6" 141 And I press "C-@" 142 And I press "C-@" 143 And I press "C-@" 144 And I press "C-S-@" 145 And I press "C-S-@" 146 And I press "C-S-@" 147 Then the region should not be active 148 And cursor should be at point "6" 149 150 Scenario: Contract region should only contract previous expansions 151 Given there is no region selected 152 When I insert "This (is some) text" 153 And I go to point "7" 154 And I set the mark 155 And I go to point "14" 156 And I press "C-S-@" 157 Then the region should be "is some" 158 159 Scenario: Contract history should be reset when changing buffer 160 Given there is no region selected 161 When I insert "This is some text" 162 And I go to point "10" 163 And I press "C-@" 164 And I press "C-@" 165 And I deactivate the mark 166 And I insert "More text" 167 And I press "C-S-@" 168 Then the region should not be active 169 170 Scenario: Expanding past the entire buffer should not add duplicates to the history 171 Given there is no region selected 172 When I insert "This is some text" 173 And I press "C-@" 174 And I press "C-@" 175 And I press "C-@" 176 And I press "C-@" 177 And I press "C-@" 178 And I press "C-S-@" 179 Then the region should be "text" 180 181 Scenario: C-g to deactivate mark and move back to start of expansions 182 Given there is no region selected 183 When I insert "(((45678)))" 184 And I go to point "6" 185 And I press "C-@" 186 And I press "C-@" 187 And I quit 188 Then the region should not be active 189 And cursor should be at point "6" 190 191 Scenario: C-g to move back to start of expansions also with cua-mode 192 Given there is no region selected 193 When I turn on cua-mode 194 And I insert "(((45678)))" 195 And I go to point "6" 196 And I press "C-@" 197 And I press "C-@" 198 And I quit 199 Then the region should not be active 200 And cursor should be at point "6" 201 202 Scenario: Pop mark twice to get back to start of expansions 203 Given there is no region selected 204 When I insert "(((45678)))" 205 And I go to point "6" 206 And I press "C-@" 207 And I press "C-@" 208 And I press "C-S-@" 209 And I press "C-@" 210 And I press "C-@" 211 And I press "C-@" 212 And I press "C-@" 213 And I press "C-S-@" 214 And I press "C-@" 215 And I press "C-@" 216 And I pop the mark 217 And I pop the mark 218 Then cursor should be at point "6" 219 220 Scenario: Pop mark thrice to get back to mark before expansions 221 Given there is no region selected 222 When I insert "(((45678)))" 223 And I go to point "8" 224 And I set the mark 225 And I deactivate the mark 226 And I go to point "6" 227 And I press "C-@" 228 And I press "C-@" 229 And I press "C-S-@" 230 And I press "C-@" 231 And I press "C-@" 232 And I press "C-@" 233 And I press "C-@" 234 And I press "C-S-@" 235 And I press "C-@" 236 And I press "C-@" 237 And I pop the mark 238 And I pop the mark 239 And I pop the mark 240 Then cursor should be at point "8" 241 242 Scenario: Transient mark mode deactivated 243 Given transient mark mode is inactive 244 And there is no region selected 245 When I insert "This is some text" 246 And I go to point "10" 247 And I press "C-@" 248 Then the region should be "some" 249 250 Scenario: Expand from existing selection without transient-mark-mode 251 Given transient mark mode is inactive 252 And there is no region selected 253 When I insert "This (is some) text" 254 And I go to point "7" 255 And I set the mark 256 And I activate the mark 257 And I go to point "14" 258 And I press "C-@" 259 Then the region should be "(is some)" 260 261 Scenario: Do not skip white space forward with active region without tmm 262 Given transient mark mode is inactive 263 And there is no region selected 264 When I insert "This is some text" 265 And I go to point "10" 266 And I set the mark 267 And I activate the mark 268 And I go to point "14" 269 And I press "C-@" 270 Then the region should be "This is some text" 271 272 Scenario: Set-mark-default-inactive 273 Given mark is inactive by default 274 And there is no region selected 275 When I insert "This (is some) text" 276 And I go to point "6" 277 And I press "C-@" 278 Then the region should be "(is some)" 279 280 Scenario: Allow pressing the last key of the sequence continuously 281 Given there is no region selected 282 When I insert "This (is (some)) text" 283 And I go to point "12" 284 And I press "C-@" 285 Then the region should be "some" 286 And I press "@" 287 Then the region should be "(some)" 288 And I press "@" 289 Then the region should be "is (some)" 290 And I press "@" 291 Then the region should be "(is (some))" 292 293 Scenario: Allow pressing `-' to contract region 294 Given there is no region selected 295 When I insert "This (is (some)) text" 296 And I go to point "12" 297 And I press "C-@" 298 Then the region should be "some" 299 And I press "@" 300 Then the region should be "(some)" 301 And I press "@" 302 Then the region should be "is (some)" 303 And I press "-" 304 Then the region should be "(some)" 305 And I press "-" 306 Then the region should be "some" 307 308 Scenario: Allow pressing `0' to reset region 309 Given there is no region selected 310 When I insert "This (is (some)) text" 311 And I go to point "12" 312 And I press "C-@" 313 Then the region should be "some" 314 And I press "@" 315 Then the region should be "(some)" 316 And I press "@" 317 Then the region should be "is (some)" 318 And I press "0" 319 Then there is no region selected 320 And cursor should be at point "12" 321 322 Scenario: Allow pressing C-g to reset region after pressing `@' 323 Given there is no region selected 324 When I insert "This (is (some)) text" 325 And I go to point "12" 326 And I press "C-@" 327 Then the region should be "some" 328 And I press "@" 329 Then the region should be "(some)" 330 And I press "@" 331 Then the region should be "is (some)" 332 And I quit 333 Then there is no region selected 334 And cursor should be at point "12" 335 336 Scenario: Allow pressing C-g to reset region after pressing `-' 337 Given there is no region selected 338 When I insert "This (is (some)) text" 339 And I go to point "12" 340 And I press "C-@" 341 Then the region should be "some" 342 And I press "@" 343 Then the region should be "(some)" 344 And I press "-" 345 Then the region should be "some" 346 And I quit 347 Then there is no region selected 348 And cursor should be at point "12" 349 350 Scenario: Autocopy-register 351 Given there is no region selected 352 And autocopy-register is "e" 353 When I insert "This is some text" 354 And I go to point "10" 355 And I press "C-@" 356 Then register "e" should be "some"