jsmecham / atom-terminal-tab

Simple terminal for the Atom text editor.
https://atom.io/packages/terminal-tab
MIT License
144 stars 29 forks source link

Uncaught TypeError: activeSession.pasteFromClipboard is not a function #70

Open iTsingchen opened 6 years ago

iTsingchen commented 6 years ago

[Enter steps to reproduce:]

  1. ...
  2. ...

Atom: 1.24.0 x64 Electron: 1.6.16 OS: Mac OS X 10.13.3 Thrown From: terminal-tab package 0.5.4

Stack Trace

Uncaught TypeError: activeSession.pasteFromClipboard is not a function

At /Users/Anzhu/.atom/packages/terminal-tab/lib/main.js:63

TypeError: activeSession.pasteFromClipboard is not a function
    at Object.handlePaste (/packages/terminal-tab/lib/main.js:63:19)
    at CommandRegistry.handleCommandEvent (/Users/Anzhu/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:388:36)
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Users/Anzhu/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Users/Anzhu/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.handleDocumentKeyEvent (/Users/Anzhu/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:108:40)

Commands

     -5:15.1.0 core:confirm (input.hidden-input)
  2x -3:52.2.0 core:copy (div.package-readme.native-key-bindings)
     -2:56.3.0 terminal:open (div.panels-item)
     -1:48.2.0 tree-view:add-file (span.name.icon.icon-file-directory)
     -1:45.2.0 core:confirm (input.hidden-input)
     -1:35.3.0 core:paste (input.hidden-input)
     -1:34.1.0 core:save (input.hidden-input)
     -1:30.6.0 core:backspace (input.hidden-input)
     -1:30.4.0 core:save (input.hidden-input)
  2x -0:26.9.0 terminal:paste (textarea.xterm-helper-textarea)

Non-Core Packages

atom-beautify 0.30.9 
atom-ide-ui 0.9.2 
atom-material-syntax 1.0.8 
atom-ternjs 0.18.3 
autoclose-html 0.23.0 
file-icons 2.1.17 
filesize 4.0.0 
highlight-selected 0.13.1 
js-hyperclick 1.13.0 
language-babel 2.84.0 
linter-eslint 8.4.1 
minimap 4.29.8 
minimap-highlight-selected 4.6.1 
prettier-atom 0.51.0 
react-es7-snippets 0.3.13 
simplified-chinese-menu 5.3.5 
status-bar-blame 2.0.2 
terminal-tab 0.5.4 
rmbaad commented 6 years ago

I have same problem

Steps to reproduce:

  1. Copy some text from editor
  2. Open terminal or focus to it
  3. Press cmd+V

or more simple way:

  1. Open terminal
  2. Press cmd+C

Atom: 1.27.0-beta1 x64 Electron: 1.7.11 OS: Mac OS X 10.12.6 Thrown From: terminal-tab package 0.5.6

Stack Trace

Uncaught TypeError: activeSession.copySelection is not a function

At /Users/jibon/.atom/packages/terminal-tab/lib/main.js:38

TypeError: activeSession.copySelection is not a function
    at Object.handleCopy (/packages/terminal-tab/lib/main.js:38:19)
    at CommandRegistry.handleCommandEvent (/Applications/Atom Beta.app/Contents/Resources/app/src/command-registry.js:384:49)
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
    at WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom Beta.app/Contents/Resources/app/src/window-event-handler.js:110:40)

Commands

     -0:08.6.0 core:close (atom-pane.pane)
     -0:02.0 terminal:copy (textarea.xterm-helper-textarea)

Non-Core Packages

atom-beautify 0.32.2 
atom-ide-ui 0.11.1 
atom-ternjs 0.18.3 
autocomplete-paths 2.12.2 
busy-signal 1.4.3 
docblockr 0.13.7 
eslint-fixer 1.3.0 
file-icons 2.1.19 
firacode 0.3.0 
flow-ide 1.11.0 
git-blame 1.6.0 
highlight-selected 0.13.1 
hyperclick 0.0.0 
importcost 0.0.3 
intentions 1.1.5 
language-dts 0.3.1 
language-postcss 1.3.1 
language-rust 0.4.12 
linter 2.2.0 
linter-eslint 8.4.1 
linter-stylelint 4.1.0 
linter-ui-default 1.7.1 
markdown-preview-plus 2.5.8 
markdown-writer 2.7.3 
minimap 4.29.8 
minimap-highlight-selected 4.6.1 
minimap-linter 2.1.3 
prettier-atom 0.51.0 
pretty-json 2.0.0 
remote-sync 4.1.8 
svg-preview 0.12.1 
sync-settings 0.8.6 
teletype 0.13.1 
terminal-tab 0.5.6 
webbox-color 0.5.9 

This bug make terminal unusable :(

hakamaq commented 6 years ago

I found a solution for this Go into packages> terminal-tab > view code

Open up lib > main.js

Modify line import { CompositeDisposable } from 'atom'; to import { CompositeDisposable, TextEditor } from 'atom';

And change the function below


  handleCopy() {
    const activeSession = atom.workspace.getActivePaneItem();
    if(activeSession instanceof TextEditor){
        activeSession.copySelectedText();
    }else{
        activeSession.copySelection();
    }

  },

  handlePaste() {
    const activeSession = atom.workspace.getActivePaneItem();
    if(activeSession instanceof TextEditor){
        activeSession.pasteText();
    }else{
        activeSession.pasteFromClipboard();
    }

  },