about summary refs log tree commit diff stats
path: root/304screen.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2021-01-22 20:57:29 -0800
committerKartik Agaram <vc@akkartik.com>2021-01-22 20:57:29 -0800
commit1b09418c60cd48d021f95a8c3f248a33421d776f (patch)
tree22ce69760518152efcaf7f0950bc751facc95336 /304screen.subx
parenta51bc7a1e0c287d9a0be9c43cd3967dcfb6107f8 (diff)
downloadmu-1b09418c60cd48d021f95a8c3f248a33421d776f.tar.gz
7542 - baremetal: support cursor on a grapheme
So far we've drawn a space implicitly at the cursor. Now I allow drawing
an arbitrary grapheme when drawing the cursor. But the caller has to
specify what to draw. (The alternative would be for layer 103 to
track every single grapheme on screen along with its color and any other
future attributes, just to be able to paint and unpaint the background
for a single character.)

I've modified existing helpers for drawing multiple graphemes to always
clear the final cursor position after they finish drawing. That seems
reasonable for terminal-like applications. Applications that need to
control the screen in a more random-access manner will need to track the
grapheme at the cursor for themselves.
Diffstat (limited to '304screen.subx')
0 files changed, 0 insertions, 0 deletions
-08 19:46:41 +0200 Merge branch 'master' into preview' href='/akspecs/ranger/commit/ranger/core/shared.py?id=8e0d73b53f164f949b55e268d9c76f0531b8c7d8'>8e0d73b5 ^
7137526a ^

03d7f28e ^

7137526a ^



8e0d73b5 ^
a4570538 ^





f7719291 ^

a4570538 ^










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
                                                                       

















                                                                       
              




































                                                                             
                                                         
                                                         
                                                                               

                                                                    
                                                             

                                                                         

                                                                                       



                                                                                          
 





                                                                               

                                                                                             










                                                                                      
# Copyright (C) 2009, 2010, 2011  Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

"""Shared objects contain singleton variables which can be
inherited, essentially acting like global variables."""

from ranger.ext.lazy_property import lazy_property
import os.path

class Awareness(object):
	pass

class EnvironmentAware(Awareness):
	# This creates an instance implicitly, mainly for unit tests
	@lazy_property
	def env(self):
		from ranger.core.environment import Environment
		return Environment(".")

class FileManagerAware(Awareness):
	# This creates an instance implicitly, mainly for unit tests
	@lazy_property
	def fm(self):
		from ranger.core.fm import FM
		return FM()

class SettingsAware(Awareness):
	# This creates an instance implicitly, mainly for unit tests
	@lazy_property
	def settings(self):
		from ranger.ext.openstruct import OpenStruct
		return OpenStruct()

	@staticmethod
	def _setup(clean=True):
		from ranger.container.settingobject import SettingObject, \
				ALLOWED_SETTINGS
		import ranger
		import sys
		settings = SettingObject()

		from ranger.gui.colorscheme import _colorscheme_name_to_class
		settings.signal_bind('setopt.colorscheme',
				_colorscheme_name_to_class, priority=1)

		def after_setting_preview_script(signal):
			if isinstance(signal.value, str):
				signal.value = os.path.expanduser(signal.value)
				if not os.path.exists(signal.value):
					signal.value = None
		settings.signal_bind('setopt.preview_script',
				after_setting_preview_script, priority=1)
		def after_setting_use_preview_script(signal):
			if signal.fm.settings.preview_script is None and signal.value \
					and not signal.previous:
				signal.fm.notify("Preview script undefined or not found!",
						bad=True)
		settings.signal_bind('setopt.use_preview_script',
				after_setting_use_preview_script, priority=1)

		if not clean:
			# add the custom options to the list of setting sources
			sys.path[0:0] = [ranger.arg.confdir]
			try:
				import options as my_options
			except ImportError:
				# XXX: This mistakenly ignores ImportErrors inside options.py
				# It should only ignore missing options.py instead.
				pass
			else:
				settings._setting_sources.append(my_options)
			del sys.path[0]

		from ranger.defaults import options as default_options
		settings._setting_sources.append(default_options)
		assert all(hasattr(default_options, setting) \
				for setting in ALLOWED_SETTINGS), \
				"Ensure that all options are defined in the defaults!"
		SettingsAware.settings = settings