@@ -47,7 +47,6 @@ private string GetTitle(IOneNoteItem item, List<int> highlightData)
47
47
highlightData [ i ] += BulletPoint . Length ;
48
48
}
49
49
return title ;
50
-
51
50
}
52
51
53
52
private string GetAutoCompleteText ( IOneNoteItem item )
@@ -234,7 +233,6 @@ await Task.Run(() =>
234
233
} ;
235
234
}
236
235
237
-
238
236
public Result CreatePageResult ( OneNotePage page , string query )
239
237
=> CreateOneNoteItemResult ( page , false , string . IsNullOrWhiteSpace ( query ) ? null : context . API . FuzzySearch ( query , page . Name ) . MatchData ) ;
240
238
@@ -256,12 +254,17 @@ public Result CreateNewPageResult(string newPageName, OneNoteSection section)
256
254
AutoCompleteText = $ "{ GetAutoCompleteText ( section ) } { newPageName } ",
257
255
IcoPath = iconProvider . NewPage ,
258
256
PreviewPanel = GetNewPagePreviewPanel ( section , newPageName ) ,
259
- Action = _ =>
257
+ Action = c =>
260
258
{
261
- OneNoteApplication . CreatePage ( section , newPageName , true ) ;
259
+ bool showOneNote = ! c . SpecialKeyState . CtrlPressed ;
260
+
261
+ OneNoteApplication . CreatePage ( section , newPageName , showOneNote ) ;
262
262
Main . ForceReQuery ( ) ;
263
- WindowHelper . FocusOneNote ( ) ;
264
- return true ;
263
+
264
+ if ( showOneNote )
265
+ WindowHelper . FocusOneNote ( ) ;
266
+
267
+ return showOneNote ;
265
268
} ,
266
269
} ;
267
270
}
@@ -279,26 +282,30 @@ public Result CreateNewSectionResult(string newSectionName, IOneNoteItem parent)
279
282
: $ "Section names cannot contain: { string . Join ( ' ' , OneNoteApplication . InvalidSectionChars ) } ",
280
283
AutoCompleteText = $ "{ GetAutoCompleteText ( parent ) } { newSectionName } ",
281
284
IcoPath = iconProvider . NewSection ,
282
- Action = _ =>
285
+ Action = c =>
283
286
{
284
287
if ( ! validTitle )
285
288
{
286
289
return false ;
287
290
}
288
291
292
+ bool showOneNote = ! c . SpecialKeyState . CtrlPressed ;
293
+
289
294
switch ( parent )
290
295
{
291
296
case OneNoteNotebook notebook :
292
- OneNoteApplication . CreateSection ( notebook , newSectionName , true ) ;
297
+ OneNoteApplication . CreateSection ( notebook , newSectionName , showOneNote ) ;
293
298
break ;
294
299
case OneNoteSectionGroup sectionGroup :
295
- OneNoteApplication . CreateSection ( sectionGroup , newSectionName , true ) ;
300
+ OneNoteApplication . CreateSection ( sectionGroup , newSectionName , showOneNote ) ;
296
301
break ;
297
302
}
298
-
303
+
299
304
Main . ForceReQuery ( ) ;
300
- WindowHelper . FocusOneNote ( ) ;
301
- return true ;
305
+ if ( showOneNote )
306
+ WindowHelper . FocusOneNote ( ) ;
307
+
308
+ return showOneNote ;
302
309
} ,
303
310
} ;
304
311
}
@@ -316,26 +323,30 @@ public Result CreateNewSectionGroupResult(string newSectionGroupName, IOneNoteIt
316
323
: $ "Section group names cannot contain: { string . Join ( ' ' , OneNoteApplication . InvalidSectionGroupChars ) } ",
317
324
AutoCompleteText = $ "{ GetAutoCompleteText ( parent ) } { newSectionGroupName } ",
318
325
IcoPath = iconProvider . NewSectionGroup ,
319
- Action = _ =>
326
+ Action = c =>
320
327
{
321
328
if ( ! validTitle )
322
329
{
323
330
return false ;
324
331
}
325
332
333
+ bool showOneNote = ! c . SpecialKeyState . CtrlPressed ;
334
+
326
335
switch ( parent )
327
336
{
328
337
case OneNoteNotebook notebook :
329
- OneNoteApplication . CreateSectionGroup ( notebook , newSectionGroupName , true ) ;
338
+ OneNoteApplication . CreateSectionGroup ( notebook , newSectionGroupName , showOneNote ) ;
330
339
break ;
331
340
case OneNoteSectionGroup sectionGroup :
332
- OneNoteApplication . CreateSectionGroup ( sectionGroup , newSectionGroupName , true ) ;
341
+ OneNoteApplication . CreateSectionGroup ( sectionGroup , newSectionGroupName , showOneNote ) ;
333
342
break ;
334
343
}
335
344
336
345
Main . ForceReQuery ( ) ;
337
- WindowHelper . FocusOneNote ( ) ;
338
- return true ;
346
+ if ( showOneNote )
347
+ WindowHelper . FocusOneNote ( ) ;
348
+
349
+ return showOneNote ;
339
350
} ,
340
351
} ;
341
352
}
@@ -353,17 +364,22 @@ public Result CreateNewNotebookResult(string newNotebookName)
353
364
: $ "Notebook names cannot contain: { string . Join ( ' ' , OneNoteApplication . InvalidNotebookChars ) } ",
354
365
AutoCompleteText = $ "{ ActionKeyword } { settings . Keywords . NotebookExplorer } { newNotebookName } ",
355
366
IcoPath = iconProvider . NewNotebook ,
356
- Action = _ =>
367
+ Action = c =>
357
368
{
358
369
if ( ! validTitle )
359
370
{
360
371
return false ;
361
372
}
362
-
363
- OneNoteApplication . CreateNotebook ( newNotebookName , true ) ;
373
+
374
+ bool showOneNote = ! c . SpecialKeyState . CtrlPressed ;
375
+
376
+ OneNoteApplication . CreateNotebook ( newNotebookName , showOneNote ) ;
364
377
Main . ForceReQuery ( ) ;
365
- WindowHelper . FocusOneNote ( ) ;
366
- return true ;
378
+
379
+ if ( showOneNote )
380
+ WindowHelper . FocusOneNote ( ) ;
381
+
382
+ return showOneNote ;
367
383
} ,
368
384
} ;
369
385
}
0 commit comments