Skip to content

Commit

Permalink
Merge pull request #1815 from timbrel/ensure-view-as-result-buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
kaste authored Dec 8, 2023
2 parents fa3fd87 + 51cdc95 commit 254b93b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions common/util/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

MYPY = False
if MYPY:
from typing import Mapping, Optional
from typing import Callable, Mapping, Optional


##############
Expand Down Expand Up @@ -77,6 +77,10 @@ def create_scratch_view(window, typ, options={}):
"read_only": True
}
update_view(view, ChainMap(options, defaults)) # type: ignore[arg-type] # mypy expects a MutableMapping here
# Call `focus_view` so that `result_file_regex` et.al. settings get applied.
# This does *not* in turn sends `on_activated` as the view gets activated
# directly after its creation.
window.focus_view(view)
return view


Expand All @@ -87,12 +91,11 @@ def update_view(view, options):
"title": view.set_name,
"scratch": view.set_scratch,
"read_only": view.set_read_only,
}

} # type: Mapping[str, Callable]
settings = view.settings()
for k, v in options.items():
if k in special_setters:
special_setters[k](v) # type: ignore[operator]
special_setters[k](v)
else:
settings.set(k, v)

Expand Down

0 comments on commit 254b93b

Please sign in to comment.