summary refs log tree commit diff stats
path: root/lib/deprecated/pure/ospaths.nim
blob: e253a3e5a01913fd529b0d1873e012f9fa6bcd8d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#
#
#            Nim's Runtime Library
#        (c) Copyright 2015 Andreas Rumpf
#
#    See the file "copying.txt", included in this
#    distribution, for details about the copyright.
#

## This module is deprecated, `import std/os` instead.

{.deprecated: "use `std/os` instead".}

import os
export ReadEnvEffect, WriteEnvEffect, ReadDirEffect, WriteDirEffect, OSErrorCode,
  doslikeFileSystem, CurDir, ParDir, DirSep, AltSep, PathSep, FileSystemCaseSensitive,
  ExeExt, ScriptExt, DynlibFormat, ExtSep, joinPath, `/`, splitPath, parentDir,
  tailDir, isRootDir, parentDirs, `/../`, searchExtPos, splitFile, extractFilename,
  lastPathPart, changeFileExt, addFileExt, cmpPaths, isAbsolute, unixToNativePath,
  `==`, `$`, osErrorMsg, raiseOSError, osLastError, getEnv, existsEnv, putEnv,
  getHomeDir, getConfigDir, getTempDir, expandTilde, quoteShellWindows,
  quoteShellPosix, quoteShell, quoteShellCommand
lass="n">y < 0: self.y += 0xFF def pressed(self, n): """Returns whether the mouse key n is pressed""" try: return (self.bstate & MouseEvent.PRESSED[n]) != 0 except IndexError: return False def mouse_wheel_direction(self): """Returns the direction of the scroll action, 0 if there was none""" # If the bstate > ALL_MOUSE_EVENTS, it's an invalid mouse button. # I interpret invalid buttons as "scroll down" because all tested # systems have a broken curses implementation and this is a workaround. # Recently it seems to have been fixed, as 2**21 was introduced as # the code for the "scroll down" button. if self.bstate & curses.BUTTON4_PRESSED: return -self.CTRL_SCROLLWHEEL_MULTIPLIER if self.ctrl() else -1 elif self.bstate & curses.BUTTON2_PRESSED \ or self.bstate & 2**21 \ or self.bstate > curses.ALL_MOUSE_EVENTS: return self.CTRL_SCROLLWHEEL_MULTIPLIER if self.ctrl() else 1 return 0 def ctrl(self): return self.bstate & curses.BUTTON_CTRL def alt(self): return self.bstate & curses.BUTTON_ALT def shift(self): return self.bstate & curses.BUTTON_SHIFT def key_invalid(self): return self.bstate > curses.ALL_MOUSE_EVENTS